package com.wll.design.策略.service.impl;

import com.wll.design.策略.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description: 通常写法  代码判断
 * @Author: Wanglulu
 * @Date: 2021/1/4 10:46
 * @Version 0.0.1
 */
@Service
public class PayServiceImplCommon implements PayService {

    @Autowired
    ZhiFuBaoPay zhiFuBaoPay;

    @Autowired
    WeiXinPay weiXinPay;

    @Autowired
    JingDongPay jingDongPay;

    @Override
    public void toPay(String code) {
        if ("ZhiFuBao".equals(code)) {
            zhiFuBaoPay.pay();
        } else if ("WeiXin".equals(code)) {
            weiXinPay.pay();
        }else if ("JingDong".equals(code)) {
            jingDongPay.pay();
        }else {
            System.out.println("暂不支持该支付方式。。。");
        }
    }


}
